def d1(func):
    def _inner(*args, **kwargs):
        print 1
        return func(*args, **kwargs)
    return _inner

def d2(func):
    def _inner(*args, **kwargs):
        print 2
        return func(*args, **kwargs)
    return _inner

@d2
@d1
def test(*args, **kwargs):
    print 'test'
    
if __name__ == '__main__':
    test()